<!DOCTYPE html>
<html lang="zh-cn">
  <head>
    <meta htttp-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>麦知网后台管理</title>

    <!-- Bootstrap core CSS -->
    <link href="../css/bootstrap.min.css" rel="stylesheet">
    <link href="../css/sco.message.css" rel="stylesheet">
    <link href="../css/scojs.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <style>
    /*
     * Style tweaks
     * --------------------------------------------------
     */
    html,
    body {
      overflow-x: hidden; /* Prevent scroll on narrow devices */
    }
    body {
      padding-top: 70px;
    }
    footer {
      padding: 30px 0;
    }

    /*
     * Off Canvas
     * --------------------------------------------------
     */
    @media screen and (max-width: 767px) {
      .row-offcanvas {
        position: relative;
        -webkit-transition: all 0.25s ease-out;
        -moz-transition: all 0.25s ease-out;
        transition: all 0.25s ease-out;
      }

      .row-offcanvas-right
      .sidebar-offcanvas {
        right: -50%; /* 6 columns */
      }

      .row-offcanvas-left
      .sidebar-offcanvas {
        left: -50%; /* 6 columns */
      }

      .row-offcanvas-right.active {
        right: 50%; /* 6 columns */
      }

      .row-offcanvas-left.active {
        left: 50%; /* 6 columns */
      }

      .sidebar-offcanvas {
        position: absolute;
        top: 0;
        width: 50%; /* 6 columns */
      }
    }
    </style>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/bootstrap.min.js"></script>
    <script src="../js/sco.message.js"></script>
    <!-- Just for debugging purposes. Don't actually copy this line! -->
    <!--[if lt IE 9]><script src="../../docs-assets/js/ie8-responsive-file-warning.js"></script><![endif]-->

    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="http://cdn.bootcss.com/html5shiv/3.7.0/html5shiv.min.js"></script>
      <script src="http://cdn.bootcss.com/respond.js/1.3.0/respond.min.js"></script>
    <![endif]-->
  </head>

  <body>
    <div class="navbar navbar-fixed-top navbar-inverse" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">麦知网后台管理</a>
        </div>
        <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">
            <li><a href="{% url 'applications:index' %}">网站情况</a></li>
            <li><a href="{% url 'applications:groups' %}">小组管理</a></li>
            <li><a href="{% url 'applications:courses' %}">课程管理</a></li>
            <li><a href="{% url 'applications:rewards' %}">悬赏管理</a></li>
            <li><a href="{% url 'applications:users' %}">用户管理</a></li>
            <li><a href="{% url 'applications:ifgroup' %}">小组审核</a></li>
            <li><a href="{% url 'applications:publisher' %}">发布者审核</a></li>
            <li class="active"><a href="#">内测—用户审核</a></li>
          </ul>
        </div><!-- /.nav-collapse -->
      </div><!-- /.container -->
    </div><!-- /.navbar -->

    <div class="container">

          <table class="table table-hover">
            <thead>
              <tr>
                <th style="width:30%;text-align:center;">email</th>
                <th style="width:10%;text-align:center;">工作</th>
                <th style="width:10%;text-align:center;">性别</th>
                <th style="width:10%;text-align:center;">年龄</th>
                <th style="width:10%;text-align:center;">所在地</th>
                <th style="width:20%;text-align:center;">操作</th>
              </tr>
            </thead>
            <tbody>
              {% for i in invite %}
              <tr id="user{{i.id}}">
                <td style="text-align:center;">{{i.email}}</td>
                <td style="text-align:center;">{{i.work}}</td>
                <td style="text-align:center;">{{i.name}}</td>
                <td style="text-align:center;">{% ifequal i.sex 1 %}男{% else %}女{% endifequal %}</td>
                <td style="text-align:center;">{{i.position}}</td>
                <td style="text-align:center;">
                  <a href="javascript:void(0)" onclick="pass_user({{i.id}});">通过</a> 
                  <a href="javascript:void(0)" onclick="not_user({{i.id}});">不通过</a>
                </td>
              </tr>
              {% endfor %}
            </tbody>
          </table>   
             
        
      </div>

      <script>
      

      var xmlHttp; 

      function createXMLRequest(){
        if(window.ActiveXObject){
          xmlHttp=new ActiveXObject("Microsoft.XMLHttp");
        } else if(window.XMLHttpRequest){
          xmlHttp=new XMLHttpRequest();
        }
      }


     
//通过内测资格申请
      function pass_user(id){   
        createXMLRequest();    
        var url='/applications/passuser/?inviteid='+id;
        xmlHttp.open("GET",url);
        xmlHttp.onreadystatechange=function(e){
          if(xmlHttp.readyState==4 && xmlHttp.status==200){
              if(xmlHttp.responseText=='1'){
                e.preventDefault();
                $.scojs_message('通过审核', $.scojs_message.TYPE_OK);
                $("#user"+id).html("");
              }else{
                e.preventDefault();
                $.scojs_message('邮件未发送成功～ ：）', $.scojs_message.TYPE_ERROR);
              }
          }else{
            e.preventDefault();
            $.scojs_message('服务器有小怪兽在捣乱～我们正在尽力捕捉～ ：）', $.scojs_message.TYPE_ERROR);
          }
        };
        xmlHttp.send(); 
      }

//驳回内测资格申请
      function not_user(id){   
        createXMLRequest();    
        var url='/applications/notuser/?inviteid='+id;
        xmlHttp.open("GET",url);
        xmlHttp.onreadystatechange=function(e){
          if(xmlHttp.readyState==4 && xmlHttp.status==200){
              if(xmlHttp.responseText=='1'){
                e.preventDefault();
                $.scojs_message('用户申请已驳回', $.scojs_message.TYPE_OK);
                $("#user"+id).html("");
              }else{
                e.preventDefault();
                $.scojs_message('邮件未发送成功～ ：）', $.scojs_message.TYPE_ERROR);
              }
          }else{
            e.preventDefault();
            $.scojs_message('服务器有小怪兽在捣乱～我们正在尽力捕捉～ ：）', $.scojs_message.TYPE_ERROR);
          }
        };
        xmlHttp.send(); 
      }
        

      </script>



      

    </div><!--/.container-->



    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    
    
  </body>
</html>
